<template>
  <div class="home">
    <el-container>
      <el-header><Header :title="title"></Header></el-header>
      <el-container>
        <el-aside style="border-right: 1px solid #ecf5ff">
          <LeftMenu></LeftMenu>
        </el-aside>
        <el-main>
          <Container ref="container">
            <div class="home_content_webview">
              <router-view></router-view>
            </div>
          </Container>
        </el-main>
      </el-container>
      <el-footer><Footer></Footer></el-footer>
    </el-container>
  </div>
</template>

<script lang="ts">
import { defineComponent, onMounted } from "vue";
import Header from "@/components/base/header/index.vue";
import LeftMenu from "@/components/base/leftMenu/index.vue";
import Container from "@/components/base/container/index.vue";
import Footer from "@/components/base/footer/index.vue";

import { useRoute, useRouter } from "vue-router";
import { useI18n } from "vue-i18n";
import { ElContainer, ElAside, ElMain, ElHeader, ElFooter } from "element-plus";
export default defineComponent({
  setup() {
    const { t } = useI18n();
    const router = useRouter();
    const route = useRoute();
    onMounted(() => {
      if (route.fullPath === "/") {
        router.push({ path: "/meter" });
      }
    }); /* 
    let testTimeout: string | number | NodeJS.Timeout | null | undefined = null;
    const loadingFullscreen = () => {
      return new Promise((resolve, reject) => {
        const loading = ElLoading.service({
          lock: true,
          text: "Loading",
          background: "rgba(0, 0, 0, 0.7)",
        });
        resolve(loading);
      });
    };
    loadingFullscreen().then((loading) => {
      testTimeout && clearTimeout(testTimeout);
      testTimeout = setTimeout(() => {
        loading.close();
      }, 2000);
    }); */
    return {
      title: t("Home"),
      //loadingFullscreen,
      //testTimeout,
    };
  },
  unmounted() {
    //this.testTimeout && clearTimeout(this.testTimeout);
  },
  components: {
    Header,
    LeftMenu,
    Container,
    Footer,
    ElContainer,
    ElAside,
    ElMain,
    ElHeader,
    ElFooter,
  },
});
</script>

<style lang="scss" scoped>
.el-header {
  padding: 0;
}
.el-footer {
  padding: 0;
  height: auto;
}
.el-aside {
  width: auto;
}
.home {
  padding: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
}
</style>
